library pkg_app_bar;

import 'package:flutter/material.dart';

/// 通用标题栏
class CustomAppBar {
  String title = "";
  bool canBack = false;
  List<Widget> trailingWidget = [];
  CustomAppBar({String? title, bool? canBack, List<Widget>? trailingWidget}) {
    this.title = title ?? "";
    this.canBack = canBack ?? false;
    this.trailingWidget = trailingWidget ?? [];
  }

  PreferredSizeWidget build(BuildContext context) {
    return AppBar(
      centerTitle: true,
      title: Text(
        title,
        style: TextStyle(color: Colors.white),
      ),
      automaticallyImplyLeading: canBack,
      actions: trailingWidget,
    );
  }
}
